Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[react devtools] Set top-level window keys related to patching the console on startup #34626

Closed
wants to merge 1 commit into from

Conversation

rbalicki2
Copy link
Contributor

@rbalicki2 rbalicki2 commented Sep 8, 2022

Summary

  • During startup, we want to do two things: initialize global values (stored on window) so that React DevTools patches the console correctly. (This is the existing practice for e.g. React in the browser). These values are read from persistent on-device storage.
  • Also, call window.__REACT_DEVTOOLS_GLOBAL_HOOK__.injectDeviceStorageMethods with { setValueOnDevice }, giving React DevTools the ability to write values to that on-device local storage.
  • This allows us to set settings that are relevant during the initial render, i.e. before React DevTools has had a chance to connect. Currently, this only affects settings controlling whether to append component stacks, etc. However, we would like to use this same functionality to control settings that control whether we are profiling.

Changelog

[DevTools] [Added] - Patch window and call injectDeviceStorageMethods, if available.

Test Plan

  • Manually tested with standalone, behaved as expected

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Sep 8, 2022
@rbalicki2 rbalicki2 changed the title [react devtools] Set top-level window keys [react devtools] Set top-level window keys related to patching the console on startup Sep 8, 2022
@rbalicki2 rbalicki2 force-pushed the rb/settings-sync branch 2 times, most recently from 776d221 to e866399 Compare September 8, 2022 00:07
@github-actions
Copy link

github-actions bot commented Sep 8, 2022

Fails
🚫

📋 Verify Changelog Format - A changelog entry has the following format: [CATEGORY] [TYPE] - Message.

CATEGORY may be:
  • General
  • iOS
  • Android
  • JavaScript
  • Internal (for changes that do not need to be called out in the release notes)

TYPE may be:

  • Added, for new features.
  • Changed, for changes in existing functionality.
  • Deprecated, for soon-to-be removed features.
  • Removed, for now removed features.
  • Fixed, for any bug fixes.
  • Security, in case of vulnerabilities.

MESSAGE may answer "what and why" on a feature level. Use this to briefly tell React Native users about notable changes.

Warnings
⚠️ 🔒 package.json - Changes were made to package.json. This will require a manual import by a Facebook employee.

Generated by 🚫 dangerJS against c68e07d

@rbalicki2
Copy link
Contributor Author

closing for now, just needed a link

@rbalicki2 rbalicki2 closed this Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants